package com.itheima.dao;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderSettingDao {
    @Insert("insert into t_ordersetting (orderDate,number,reservations) values(#{orderDate},#{number},#{reservations})")
    public void add(OrderSetting orderSetting);

    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    public void updateAdd(OrderSetting date);

    @Select("select * from t_ordersetting where orderDate = #{date}")
    public List<OrderSetting> selectCount(Date date);

    @Select("select * from t_ordersetting where orderDate between #{begin} and #{end}")
    public List<OrderSetting> getOrderSettingByMonth(Map<String,String> map);

    @Select("select number from t_ordersetting where orderDate = #{date}")
    int selectNumber(Date orderDate);

    @Update("update t_ordersetting set reservations = #{number} where orderDate = #{date}")
    void updatereservations(@Param("number") int number,@Param("date") Date date);

    @Delete("delete from t_ordersetting where orderDate = #{date}")
    void deleteByDate(Date orderDate);

    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void updateNumber(OrderSetting orderSetting);

    @Select("SELECT DAY(orderDate) date,number,reservations FROM t_ordersetting WHERE orderDate BETWEEN #{begin} AND #{end}")
    List<Map> getOrderSettingByMonth2(Map<String, String> map);

    @Select("select * from t_ordersetting where orderDate = #{date} ")
    OrderSetting selectByDate(Date orderDate);
}
